/*
 * form_filling.h
 *
 *  Created on: 11/12/2008
 *      Author: desadoc
 */

#ifndef FORM_FILLING_H_
#define FORM_FILLING_H_

#include <QWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
#include <QLineEdit>
#include <QLabel>
#include <QTableWidget>
#include <QTableWidgetItem>
#include <QGroupBox>
#include <QComboBox>
#include <QSpinBox>
#include <QScrollArea>
#include <QList>
#include <QSpinBox>

#include "formulario.h"
#include "logica.h"

class form_filling : public QWidget {

	int qt;
	QScrollArea *scrollArea;
	QWidget *scrollAreaWidgetContents;
	QVBoxLayout* layout;
	QVBoxLayout* formLay;

	QList<formulario*> formList;

	QWidget* botoes;
	QHBoxLayout* botLay;
	QPushButton* add;
	QPushButton* del;
	QPushButton* next;
	QPushButton* previous;

	QSpinBox* curNum;

    void novoFormulario(void);
    bool loadFile(const QString &fileName);
	void cut(){}
	void copy(){}
	void paste(){}
    QString filename();
    QString newFilename();
    QList<formulario*>& getFormList();
    bool saveFile(const QString &fileName);
    QString userFriendlyCurrentFile();
    QString currentFile() { return curFile; }

public:
    form_filling();
    void openForm(QString file);

protected:
    void closeEvent(QCloseEvent *event);

private slots:
    void documentWasModified();

private:
	int quant;
    bool maybeSave();
    void showForm(int qt);
    void setCurrentFile(const QString &fileName);
    QString strippedName(const QString &fullFileName);

    QString curFile;
    bool isUntitled;

public slots:
	void adicionar();
	void remover();
	void monitoraSelecao();
	void nextForm();
	void previousForm();
};

#endif /* FORM_FILLING_H_ */
